home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1985 May / 1985-05.d64 / jog log_vic (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  134 lines

  1. 10 cl$=chr$(147):r$=chr$(18):rf$=chr$(146):d1$=chr$(17):u1$=chr$(145):q$=","
  2. 15 cr$=chr$(13)
  3. 20 u3$=u1$+u1$+u1$:d2$=d1$+d1$:om$="(eq,ne,gt,lt,ge,le)":m$="camdsx"
  4. 30 printcl$tab(5)d2$r$"jogger's log"rf$d1$:input"max # of runs ";rm
  5. 40 dimdm%(12),c$(5,2),tb%(2,rm),n%(5),op$(5),vl$(5),d$(5)
  6. 50 fori=1to12:readdm%(i):next
  7. 60 forj=1to2:fori=1to5:readc$(i,j):nexti:nextj
  8. 70 gosub120:onmgoto690,750,790,850,910,200:goto70
  9. 80 print"can't do past";r:fori=1to2500:next:goto70
  10. 90 input#15,a,b$,c,d:ifa=0thenreturn
  11. 100 printd2$"error on disk":printa;b$;c;d:goto200
  12. 110 rem main menu
  13. 120 b$="":print"[147] c[146] create a file":print" a[146] add a record"
  14. 130 print" m[146] modify a record":print" d[146] delete a record"
  15. 140 print" s[146] show a record":print" x[146] exit"
  16. 150 input" ";b$:form=1to6:ifb$<>mid$(m$,m,1)thennext
  17. 160 return
  18. 170 rem misc subroutines
  19. 180 b$="y":printtab(14)b$u1$:input"another(y/n)";b$:printcl$:return
  20. 190 input"name ";f$:input"run# ";p:close15:open15,8,15:gosub270:return
  21. 200 close1:close2:close15:end
  22. 210 input"name ";f$:close15:close2:open15,8,15:open2,8,2,"#":gosub270:return
  23. 220 forz=1to5:print"#";z;r$c$(z,1)rf$" "d$(z)d1$:nextz:return
  24. 230 printd1$r$"cr"rf$" to continue":inputb$:printcl$:return
  25. 240 printd2$r$c$(z,1)rf$,c$(z,2):inputd$(z):return
  26. 250 rem disk subroutines
  27. 260 rem get index file
  28. 270 open1,8,0,"0:"+f$+".indx,s,r":gosub90
  29. 280 forn=1to600:input#1,tb%(1,n),tb%(2,n):ifst>64thenr=n-1:close1:return
  30. 290 ifn>rmthenprint"increase max run#":goto200
  31. 300 nextn
  32. 310 rem save index file
  33. 320 open1,8,1,"@0:"+f$+".indx,s,w":gosub90
  34. 330 forn=1tor:print#1,tb%(1,n)cr$tb%(2,n):gosub90:nextn:close1:close15:return
  35. 340 rem find next free track & block
  36. 350 t=1:b=1
  37. 360 print#15,"b-a:"0;t;b:input#15,a,b$,c,d:ifa=65thent=c:b=d:goto360
  38. 370 tb%(1,p)=t:tb%(2,p)=b
  39. 380 rem write run# p
  40. 390 print#2,d$(1)q$d$(2)q$d$(3)q$d$(4)q$d$(5)
  41. 395 print#15,"b-w:"2;0;tb%(1,p);tb%(2,p):return
  42. 400 rem    read run# p
  43. 410 t=tb%(1,p):b=tb%(2,p):print#15,"b-r:"2;0;t;b
  44. 420 input#2,d$(1),d$(2),d$(3),d$(4),d$(5):return
  45. 430 rem end disk subroutines
  46. 440 rem selection
  47. 450 printcl$d1$r$"selection criteria"rf$:printd2$"enter #,option,value"d2$
  48. 460 forx=1to5
  49. 470 forz=1to5:print"#";z;"is for ";c$(z,1):nextz
  50. 480 printtab(5)d2$"options =":printom$d1$:n%(x)=0:inputn%(x),op$(x),vl$(x):printcl$
  51. 490 ifn%(x)=0thenx=x-1:return
  52. 500 nextx:return
  53. 510 rem calc pace
  54. 520 mi=val(mid$(tm$,1,2))*60+val(mid$(tm$,3,2))
  55. 530 mi=mi+val(mid$(tm$,5,2))/60:printds$"mi";
  56. 540 pa=mi/val(ds$):pm=int(pa):ps=int((pa-pm)*60):tm$=str$(pm):a=len(tm$):b$=str$(ps)
  57. 550 d=len(b$):ds$="":ifd=2thends$="0"
  58. 560 print"..."mid$(tm$,2,a-1)":"ds$mid$(b$,2,d-1)" pace":return
  59. 570 rem calc day#
  60. 580 u=val(left$(dy$,2)):ifu<1oru>12thenprintt"bad month";dy$:goto200
  61. 590 da=dm%(u)+val(right$(dy$,2))*365+val(mid$(dy$,3,2)):return
  62. 600 rem keep him honest
  63. 610 forz=1to3step2:iflen(d$(z))<>6thenprintd$(z):goto200
  64. 620 nextz:return
  65. 630 rem data base subroutines
  66. 640 rem data entry
  67. 650 printcl$"enter data on run#";p
  68. 660 forz=1to5:d$(z)="":gosub240:nextz
  69. 670 gosub610:gosub350:return
  70. 680 rem create a file
  71. 690 input" name ";f$:open15,8,2,f$+".indx,s,r":open11,8,15:input#11,a$,b$,c$
  72. 700 ifb$<>"file not found"thenprintf$" already exists":close11:close15:goto690
  73. 710 close11:close15:open15,8,15:open2,8,2,"#"
  74. 720 forp=1torm:gosub650:gosub180:ifb$="y"thennextp
  75. 730 r=p:gosub320:close2:goto70
  76. 740 rem add an entry
  77. 750 gosub210:ifr+1>rmthen80
  78. 760 r=r+1:p=r:gosub650
  79. 770 gosub320:close2:goto70
  80. 780 rem modify run# p
  81. 790 gosub190:close2:open2,8,2,"#":ifp>rthen80
  82. 800 gosub410:print"[147]":gosub220
  83. 810 z=0:input"modify #";z:ifz=0thengosub610:gosub390:close2:close15:goto70
  84. 820 ifz>=6thenprint"bad #":goto810
  85. 830 gosub240:goto810
  86. 840 rem delete an entry
  87. 850 gosub190:ifp>rthen80
  88. 860 print#15,"b-f:"0;tb%(1,p);tb%(2,p)
  89. 870 if p<rthen forz=p+1tor:tb%(1,z-1)=tb%(1,z):tb%(2,z-1)=tb%(2,z):nextz
  90. 880 r=r-1:gosub320:close2:goto70
  91. 890 rem analysis subroutines
  92. 900 rem show results
  93. 910 gosub210:gosub450
  94. 920 wm=0:wt=0:bg=0:printd2$"enter 1-list",tab(6)"2-pace",tab(6)"3-plot"
  95. 930 inputtx:printcl$:iftx<>3then950
  96. 940 printcl$"one *=how many miles":inputsc:sc=1/sc
  97. 950 forp=1tor:gosub410:c=0:ifx=0then1060
  98. 960 rem logical selection
  99. 970 forw=1tox:n=n%(w)
  100. 980 ifop$(w)="eq"thenifd$(n)=vl$(w)thenc=c+1:goto1040
  101. 990 ifop$(w)="ne"thenifd$(n)<>vl$(w)thenc=c+1:goto1040
  102. 1000 ifop$(w)="lt"thenifd$(n)<vl$(w)thenc=c+1:goto1040
  103. 1010 ifop$(w)="gt"thenifd$(n)>vl$(w)thenc=c+1:goto1040
  104. 1020 ifop$(w)="le"thenifd$(n)<=vl$(w)thenc=c+1:goto1040
  105. 1030 ifop$(w)="ge"thenifd$(n)>=vl$(w)thenc=c+1:goto1040
  106. 1040 nextw
  107. 1050 ifc<>xthen1250
  108. 1060 ontxgoto1080,1110,1170
  109. 1070 rem list
  110. 1080 print"          "r$"run#"rf$;p;d1$:gosub220:printd2$d1$:gosub230
  111. 1090 goto1250
  112. 1100 rem pace
  113. 1110 dy$=d$(1):gosub580:ifbg=0thenbg=da
  114. 1120 tm$=d$(3):ds$=d$(2):gosub520:wm=wm+mi/pa:wt=wt+mi
  115. 1130 ifda>=bg+6thenbg=bg+7:ds$=str$(wm):mi=wt:printr$ds$"mi/wk"rf$;:gosub540:wm=0:wt=0
  116. 1140 ifwt=0thengosub230
  117. 1150 goto1250
  118. 1160 rem graph
  119. 1170 dy$=d$(1):gosub580:ifbg=0thenbg=da:e=0
  120. 1180 n0=da-bg:bg=da:ifn0<2then1200
  121. 1190 forz=2ton0:print"0":e=e+1:next
  122. 1200 ns=int(val(d$(2))*sc+.5):b$="*":ifns=1then1230
  123. 1210 ifns>23thenns=23
  124. 1220 forz=2tons:b$=b$+"*":nextz
  125. 1230 printb$:e=e+1:ife>15thene=0:gosub230
  126. 1240 ife=0thenforz=1to16:print" ";:next:print"[145][145]"
  127. 1250 nextp
  128. 1260 close1:close2:close15
  129. 1270 iftx<>1thengosub230
  130. 1280 goto 70
  131. 1290 data0,31,59,90,120,151,181,212,243,273,304,334
  132. 1300 datadate,distance,time,route,comments,(mmddyy),(miles),(hhmmss)
  133. 1310 data(< 88 chrs),(< 88 chrs)
  134.